from Base.Base import Base
from selenium.webdriver.common.by import By
import time

class Page(Base):
    # https://mail.163.com/
    # 账号登录 class="loginbox-title"
    dy1_loc = (By.CLASS_NAME,'loginbox-title')
    def dy1(self):
        return self.text(self.dy1_loc)
    # 框架 id="x-URS-iframe1760319158046.8115"
    # //*[@id="x-URS-iframe1760321994141.8699"]
    kj_loc = (By.XPATH,'//iframe[starts-with(@id,"x-URS-iframe")]')
    def kj(self):
        self.iframe(self.kj_loc)

    # 用户名 name="email",id="auto-id-1760320481887"
    username_loc = (By.TAG_NAME,'input')
    def username(self,username):
        self.send_keys(self.username_loc,username)

    # 密码 name="password"
    password_loc = (By.NAME,'password')
    def password(self,password):
        self.send_keys(self.password_loc,password)

    # 登录 id="dologin"
    dologin_loc = (By.ID,'dologin')
    def dologin(self):
        self.click(self.dologin_loc)


    def luoji_01(self,username,password):
        self.open('https://mail.163.com/')
        # print(self.dy1())
        # assert '账号登录' == self.dy1()
        self.kj()
        self.username(username)
        self.password(password)
        time.sleep(3)
        self.dologin()
        self.iframe_content()